<template>
  <div>
    <div class="mon_nav">
      <div class="nav_top">
        <span>
          <router-link style="color:#FFFFCC; display:inline-block; width:40px; height:30px;" :to="{name:'money_tixian',query:{money:list.companyBalance}}">提现</router-link>
        </span>
      </div>
      <div class="nav_bom">店铺总资产(元)</div>
      <div class="nav_money">{{list.companyBalance |amountMin100(2)}}</div>
      <div class="nav_shouru">昨日净收入:+{{list.beforeMoney |amountMin100(2)}}</div>
      <!-- <div class="nav_last">在途订单:{{list.downMoney |amountMin100(2)}}</div> -->
      <div class="bom_title">收益明细</div>
    </div>

    <div class="box_list">
    <ul>
      <li class="msglist" v-for="item in haplist" :key="item.orderId">
         <div>余额:{{item.companyBalance |amountMin100(2)}}</div>
         <div>
           <p v-if="item.orderType==-2||item.orderType==-1||item.orderType==-3||item.orderType==-4" style="font-size:16px; text-align:right;">-{{item.companyProfit|amountMin100(2)}}</p>
             <p v-else style="font-size:16px; text-align:right;">+{{item.companyProfit|amountMin100(2)}}</p>
           <p style="font-size:13px;">{{item.ctime |formatDateTIME()}}</p>
         </div>
      </li>

           <li class="gengduo" @click="wants()">
               查看更多
           </li>
    </ul>
    </div>

    <div class="box_home">
      <router-link to>
        <div class="home_title">
          <span>店铺收支</span>
          <span>今日店铺收支数据</span>
        </div>
        <div class="home_bom">
          <span>收入(元)</span>
          <span>支出(元)</span>
        </div>
        <div class="home_money">
          <span>{{list.todayMoney |amountMin100(2)}}</span>
          <span>{{list.todayTxMoney |amountMin100(2)}}</span>
        </div>
        <div class="home_box">
          <span id="firstsp"></span>
          <span id="lastsp"></span>
        </div>
      </router-link>
    </div>

    <!-- <div class="box_bom">
      <router-link to>
        <div class="home_title">
          <span>店铺总盈利</span>

        </div>
        <div class="box_msg">6666.66</div>
      </router-link>
    </div> -->
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      list:'',
      haplist:'',
      jian:''
    };
  },
  mounted() {
    this.info();
    this.hones()
  },
  methods: {
    hones(){
         this.$http
        .get(this.APIURL_PREFIX + "/api/wap/company/profit",{params:{page:1,rows:4}})
        .then(res => {
              console.log(res)
              this.haplist=res.data.data
              // console.log(this.haplist.orderType)
              // if(res.data.data.orderType=='2'||res.data.data.orderType=='-1'){
              //   this.jian='-'
              // }else{
              //   this.jian='+'
              // }
        })
    },
    wants(){
        this.$router.push({ path: 'me_monxq', query: { balancetype: 1 } })
    },
    info() {
      this.$http
        .get(this.APIURL_PREFIX + "/api/wap/myWallet")
        .then(res => {
            console.log(res)
            this.list=res.data.data
            console.log(this.list)
            // this.list.todayMoney=5
            // this.list.todayTxMoney=7
            if(this.list.todayMoney==this.list.todayTxMoney){
              $('#firstsp').attr('style','width:50%')
              $('#lastsp').attr('style','width:50%;')
            }else if(this.list.todayMoney>this.list.todayTxMoney){
              console.log('大于')
                $('#firstsp').attr('style','width:75%')
              $('#lastsp').attr('style','width:25%;')
            }else{
                 $('#firstsp').attr('style','width:25%')
              $('#lastsp').attr('style','width:75%;')
            }
        });
    }
  }
};
</script>

<style scoped>
@import "../../assets/personal/css/me_money.css";
</style>
